package com.songlanyun.modules.studyingDetail.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.songlanyun.common.drive.RootEntity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@TableName("yxt_studying_detail")
public class StudyingDetail extends RootEntity<Long, StudyingDetail> implements Serializable {

    /**
     * id
     */
    @TableId
    private Long id;
    /**
     * 所属课程
     */
    @NotNull(message = "所属课程不能为空")
    private Long studying;
    /**
     * 章节名称
     */
    @NotEmpty(message = "章节名称不能为空")
    private String studyingDetailName;
    /**
     * 章节封面
     */
    @NotEmpty(message = "章节封面不能为空")
    private String studyingDetailUrl;
    /**
     * 章节内容
     */
    @NotEmpty(message = "章节内容不能为空")
    private String studyingDetailContentUrl;
    /**
     * 视频时长（分钟）
     */
    @NotNull(message = "视频时长不能为空")
    private BigDecimal videoLength;
    /**
     * 视频大小（MB）
     */
    @NotNull(message = "视频大小不能为空")
    private BigDecimal videoSize;
    /**
     * 点击量
     */
    private Integer videoClick;
    /**
     * 序号
     */
    @NotNull(message = "序号不能为空")
    private Integer hasOrder;
    /**
     * 状态 0下架 1上架 默认1
     */
    private Boolean hasStatus;
    /**
     * 是否删除0否1是默认0
     */
    @TableLogic(value = "0", delval = "1")
    private Boolean hasDelete;
    /**
     *
     */
    private Long createBy;
    /**
     *
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     *
     */
    private Long updateBy;
    /**
     *
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Override
    public Long getIdentity() {
        return getId();
    }
}
